package com.ruiysoft.website.controller;

import com.ruiysoft.website.entity.CmsLeavecomments;
import com.ruiysoft.website.service.CmsLeaveCommentsService;
import com.ruiysoft.website.service.CmsMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * Created by liudh on 2019/4/25.
 */

@RestController
@RequestMapping("leave")
public class CmsLeaveCommentsController {
    @Autowired
    CmsLeaveCommentsService cmsLeaveCommentsService;

    @Cacheable(value="selectListByEnterpriseId")
    @GetMapping("selectListByEnterpriseId")
    public Object selectListByEnterpriseId(String enterpriseId, String parentCode) {
        return cmsLeaveCommentsService.selectList(enterpriseId);
    }

    @PostMapping("save")
    public Object svae(@RequestBody CmsLeavecomments cmsLeavecomments) {
        cmsLeavecomments.setCreateTime(new Date() );
        cmsLeavecomments.setId(1);
        return cmsLeaveCommentsService.save(cmsLeavecomments);
    }
}

